import book.Book;
import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Main {
    public static User selectUser(){
        System.out.println("请输入你的名字");
        Scanner scan = new Scanner(System.in) ;
        String name = scan.nextLine() ;
        System.out.println("请输入你的身份 : -- > 1. 管理员  2. 学生");
        int ret = scan.nextInt() ;
        if(ret == 1){
            System.out.println("hello " +name + "欢迎来到图书管理系统");
            return new AdminUser(name) ;
        }else{
            System.out.println("hello " +name + " 同学，欢迎来到图书系统");
            return new NormalUser(name) ;
        }
    }

    public static void main(String[] args) {
        BookList bookList = new BookList() ;
        User user = selectUser() ;

        while(true){
            int choice = user.menu();
           if(choice != -1){
               user.doOperation(choice,bookList);
           }else{
               System.out.println("错误，请重新输入");
           }
        }

    }


}
